/* Ninja.h
 * Contains every information related to a ninja:
 *
 * Last Modified: 31.01.2014
 * Author: Guilherme S.G.
 */

#ifndef __JB_NINJA_H__
#define __JB_NINJA_H__

#include "Global.h"
#include "ResourceManager.h"
#include "Jutsu.h"
#include "HandSeal.h"

typedef enum{STAND, RUN, FALLBACK, HIT, DEAD, ATTACK} NINJA_STATE;

class Ninja
{
private:
    std::string name;
    std::string element;
    std::string family;
    std::string description;
    std::vector<Jutsu*> jutsus;
    std::vector<std::pair<std::string,Sprite*> > animation;
    Jutsu *currentJutsu;
    
    Coordinate coord;
    NINJA_STATE state;
    std::vector<HandSeal*> stack;
    
    Sprite *currentAnimation;
    int lookingDirection;
    
public:
    Ninja(std::string name_, std::string element_, std::string family_, std::string description_);
    ~Ninja();
    
    void render();
    void update();
    
    void addAnimation(Sprite *newAnimation_);
    void addJutsu(Jutsu *newJutsu_);
    void addSealToStack(HandSeal *seal_);
    void setPosition(double positionX_, double positionY_);
    static Ninja* loadChar(std::string filename_);
    void setAnimationParameters(int animationID_, int frameDelay_, int animationDirection_, int start_, int end_, int cycles_);
    HandSeal* getStackTip();
    
    int getPosX()               {return coord.x;}
    int getPosY()               {return coord.y;}
    Coordinate getCoord()       {return coord;}
    std::string getName()       {return name;}
    std::string getElement()    {return element;}
    std::string getFamily()     {return family;}
    std::string getDescription()    {return description;}
    
    Sprite *getAnimation(std::string tag_);
    Sprite* getPortrait();
    
    void setLookingDirection(int direction_)     {lookingDirection = direction_;}

};

#endif
